<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
	href="http://code.jquery.com/ui/1.10.3/themes/sunny/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css" />
<script type="text/javascript"
	src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#goToReplyCheckBtn").click(function(){
			$("#replyTable").show();
		});
		
		$("#replyForm").submit(function(){
			if($("#replyTitle").val()==""){
				alert("답변 제목을 입력하세요.");
				$("#replyTitle").focus();
				return false;
			}else if($("#replyContent").val()==""){
				alert("답변 내용을 입력하세요.");
				$("#replyContent").focus();
				return false;
			}else if($("#replyAuthor").val()==""){
				alert("먼저 관리자 로그인하세요.");
				location.href="loginPage.killer";
			}
		});
		
		$("#replyTitle").mouseup(function(){
			$("#replyTitle").val("");
			$("#replyTitle").focus();
		});
		
		
	});
</script>
</head>
<body>
<c:set var="qbvo" value="${requestScope.qbvo }"></c:set>

<table border="1" width="800">
	<tr>
		<td colspan="2"><b>문의 제목: </b>${qbvo.qnaTitle }</td>
	</tr>
	<tr>
		<td><b>글쓴이 아이디: </b>${qbvo.qnaAuthor }</td> 
		<td><b>작성 일자: </b>${qbvo.qnaDate }</td>
	</tr>
	<tr>
		<td colspan="2" height="300">
			<b>문의 내용: </b><br>
			${qbvo.qnaContent }
		</td>
	</tr>
</table>

<c:if test="${sessionScope.avo!=null && sessionScope.mvo==null }">
	<input type="button" id="goToReplyCheckBtn" value="답변 쓰기"><br><br>
	
	<form action="writeQnaReply.killer" method="post" id="replyForm">
		<table border="1" width="400" style="display: none;" id="replyTable">
			<tr>
				<td>
					<b>답변 제목: </b>
					<input type="text" id="replyTitle" name="qnaTitle" value="RE: ${qbvo.qnaTitle }">
				</td>
			</tr>
			<tr>
				<td>
					<b>글쓴이 아이디: 관리자 - ${sessionScope.avo.adminId }</b>
					<input type="hidden" id="replyAuthor" name="qnaAuthor" value="${sessionScope.avo.adminId }">
				</td> 
			</tr>
			<tr>
				<td colspan="2" height="300">
					<b>답변 내용: </b><br>
					<textarea rows="10" cols="60"  id="replyContent" name="qnaContent" style="resize:none"></textarea><br>
					<input type="hidden" name="ref" value="${qbvo.ref }">
					<input type="hidden" name="restep" value="${qbvo.restep }">
					<input type="hidden" name="relevel" value="${qbvo.relevel }">
					<input type="submit" value="답변 등록">
				</td>
			</tr>
		</table>
	</form>
	
</c:if>

</body>
</html>
















